package com.huike.web.controller.report;

import com.huike.business.domain.TbBusiness;
import com.huike.business.service.ITbBusinessService;
import com.huike.clues.domain.TbClue;
import com.huike.clues.service.ITbClueService;
import com.huike.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huike.common.core.controller.BaseController;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/report")
public class ReportController extends BaseController {
    @Autowired
    private ITbClueService tbClueService;
    @Autowired
    private ITbBusinessService tbBusinessService;


    @GetMapping(value = "/getVulnerabilityMap/{beginCreateTime}/{endCreateTime}")
    public AjaxResult getInfo(@PathVariable("beginCreateTime") String beginCreateTime, @PathVariable("endCreateTime")String endCreateTime) {
        Map<String,Integer> data = new HashMap<>();

        //线索数量
        TbClue tbClue = new TbClue();
        Map<String, Object> params = new HashMap<>();
        params.put("beginCreateTime",beginCreateTime);
        params.put("endCreateTime",endCreateTime);
        tbClue.setParams(params);
        List<TbClue> list = tbClueService.selectTbClueList(tbClue);
        int count = list.size();


        TbBusiness tbBusiness = new TbBusiness();
        tbBusiness.setBeginCreateTime(beginCreateTime);
        tbBusiness.setEndCreateTime(endCreateTime);
        List<TbBusiness> businessList = tbBusinessService.selectTbBusinessList(tbBusiness);

        data.put("cluesNums",count);
        data.put("businessNums",businessList.size());
        data.put("contractNums",1);
        data.put("effectiveCluesNums",1);

        return AjaxResult.success( data);
    }

}